import { FC } from 'react';
import { connect, Loading, ConnectProps } from 'umi';
import styles from './index.less';
import { LoginModelState } from './model';
import Login from '@/components/Login';
import NavBar from '@/components/NavBar';

interface PageProps extends ConnectProps {
  home: LoginModelState;
  loading: boolean;
}

const IndexPage: FC<PageProps> = function ({ home, dispatch }) {
  const { name } = home;
  return (
    <div className={styles.loginPage}>
      <NavBar title="登录" />
      <div className={styles.loginContainer}>
        <Login showForgetPwd showRegister />
      </div>
    </div>
  );
};

export default connect(
  ({ home, loading }: { home: LoginModelState; loading: Loading }) => ({
    home,
    loading: loading.models.home,
  }),
)(IndexPage);
